package org.example.campsys.config;

import lombok.extern.slf4j.Slf4j;
import org.example.campsys.model.Result;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@Slf4j
@ResponseBody
public class ErrorHandler {
    @ExceptionHandler
    public Result exception(Exception e){
        log.error("发生异常e:{}",e);
        return Result.fail("内部错误",false);
    }
}
